/***************************************************************************
 *   Copyright (C) 2007 by gaojian   *
 *   gaojian2008cnn@126.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef TRANSLATEDIALOG_H
#define TRANSLATEDIALOG_H

#include <translatedialogbase.h>
#include <qlistview.h>
#include <qpoint.h>
class KHTMLPart;
class VocabularyList;
class Dictionary;
class KURL;
class QSplitter;
class PreferencesDialog;
class KSystemTray;
class KToggleAction;
class floatWin;
/**
	@author gaojian <gaojian2008cnn@126.com>
*/
class TranslateDialog : public TranslateDialogBase
{
Q_OBJECT
public:
    TranslateDialog(QWidget* parent = 0, const char* name = 0);

     ~TranslateDialog();

    virtual void fetchResults();
    virtual void textChanged(const QString& arg1);
    virtual void translateClicked();
    virtual void fetchWordClicked(bool );//这是主窗口中的取词选项发送的信号
private:
    QSplitter* splitter;
    KHTMLPart* htmlpart;
    VocabularyList*  wordlist;
    Dictionary *dict;
    PreferencesDialog *preDialog;
    KSystemTray *mytray;
    KToggleAction* fetchWordAction;
    floatWin* fetchWordWin;
private slots:
    void openURLRequest(const KURL &url);
    void showResult(const QString &html);
    void showSearchError(const QString &html);
    void mousePressed(int button, QListViewItem *i, const QPoint &, int);//接收生词列表的单击事件
    void showConfigureDialog();
    void fetchWordCheck();//这是系统托盘菜单中取词选项发送的信号
    void showFetchResultSlot(const QString &word);//接受取词窗口的双击事件
protected:
    void closeEvent ( QCloseEvent * e );
private:
    void showWelcome();
    void fetchWord(bool fetch);
};

#endif
